package com.hiwan.system.enumeration;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum OrgLevelEnum{

	HQ("1", "总行"),
	Province("2", "省分行"),
	City("3", "处理失败"),
	County("4", "区/县"),
	Dot("5", "网点");
	
	private final String code;
	private final String desc;
	
	OrgLevelEnum(String code, String desc){
		this.code = code;
		this.desc = desc;
	}
	
	public String getCode() {
		return code;
	}
	
	public String getDesc() {
		return desc;
	}
	
    public static String parse(String code) {
        for (OrgLevelEnum s : OrgLevelEnum.values()) {
            if (s.code == code) {
                return s.desc;
            }
        }
        return null;
    }
    
    public static List<Map<String, String>> getAllEnum() {
        List<Map<String, String>> l = new ArrayList<Map<String, String>>();
        OrgLevelEnum[] s = OrgLevelEnum.values();
        for (OrgLevelEnum companyType : s) {
            Map<String, String> maps = new HashMap<String, String>();
            maps.put("code", String.valueOf(companyType.code));
            maps.put("desc", companyType.desc);
            l.add(maps);
        }
        return l;
    }
}